#include<stdio.h>
#include<string.h>
int main()
{
    int n;
    scanf("%d",&n);
    int a[n][n];
     memset(a, 0, sizeof(a));
    int hang=0;
    int lie=n/2;
    a[hang][lie]=1;
    for(int i=2;i<=n*n;i++)
    {
        if(hang==0&&lie!=(n-1))
        {
            a[n-1][lie+1]=i;
            hang=n-1;
            lie=lie+1;
        }else if(hang!=0&&lie==(n-1))
        {
           a[hang-1][0]=i;
           hang=hang-1;
           lie=0;
        }else if(hang==0&&lie==n-1)
        {
            a[hang+1][lie]=i;
            hang=hang+1;
        }else if(hang!=0&&lie!=n-1&&a[hang-1][lie+1]==0)
        {
            a[hang-1][lie+1]=i;
            hang=hang-1;
            lie=lie+1;
        }else{
            a[hang+1][lie]=i;
            hang=hang+1;
            
        }
    }
    for(int i=0;i<n;i++)
    {
        for(int j=0;j<n;j++)
        {
          printf("%d ",a[i][j]);
        }printf("\n");
    }
    return 0;
}